{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import xml.etree.ElementTree as ET \n",
    "tree = ET.ElementTree(file=\"full_database.xml\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "root = tree.getroot() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "druglist=['Ifosfamide','Amifostine', 'Chlorambucil',\n",
    " 'Hydroxyurea', 'Estramustine phosphate sodium',\n",
    " 'Exemestane', 'Thiotepa', 'Thalidomide',\n",
    " 'Thioguanine', 'Gefitinib' ,'Sorafenib tosylate',\n",
    " 'Procarbazine hydrochloride', 'Melphalan', 'Ruxolitinib',\n",
    " 'Teniposide', 'Oxaliplatin', 'Pemetrexed Disodium',\n",
    " 'Fulvestrant', 'Vinorelbine tartrate' ,'Crizotinib',\n",
    " 'Axitinib', 'Valrubicin', 'Dactinomycin',\n",
    " 'Romidepsin', 'Carmustine' ,'Mitotane',\n",
    " 'Erlotinib hydrochloride', 'Vandetanib', 'Cladribine',\n",
    " 'Daunorubicin hydrochloride', 'Vismodegib',\n",
    " 'Megestrol acetate', 'Lenalidomide', 'Tamoxifen citrate',\n",
    " 'Quinacrine hydrochloride' ,'Bortezomib',\n",
    " 'Vincristine sulfate', 'Uracil mustard', 'Dacarbazine',\n",
    " 'Lomustine', 'Mitoxantrone', 'Cytarabine hydrochloride',\n",
    " 'Arsenic trioxide' ,'Vinblastine sulfate', 'Cabazitaxel',\n",
    " '2-Fluoro Ara-A', 'Methoxsalen' ,'Everolimus',\n",
    " 'pralatrexate' ,'Floxuridine']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<Element '{http://www.drugbank.ca}drug' at 0x7eff0bd39ef0> Bortezomib\n",
      "========================================================================\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Everolimus\n",
      "Crizotinib\n",
      "Romidepsin\n",
      "Vandetanib\n",
      "Ifosfamide\n",
      "Teniposide\n",
      "Mitoxantrone\n",
      "Gefitinib\n",
      "Axitinib\n",
      "Methoxsalen\n",
      "Vismodegib\n",
      "Mitotane\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7eff01ad1e50> Cladribine\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Gefitinib\n",
      "Vandetanib\n",
      "Vismodegib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efefe1e03b0> Carmustine\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Melphalan\n",
      "Megestrol acetate\n",
      "Methoxsalen\n",
      "Axitinib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efef7721bd0> Chlorambucil\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efeef22d3b0> Gefitinib\n",
      "========================================================================\n",
      "Mitotane\n",
      "Cladribine\n",
      "Oxaliplatin\n",
      "Dactinomycin\n",
      "Mitoxantrone\n",
      "Vismodegib\n",
      "Vandetanib\n",
      "Bortezomib\n",
      "Ifosfamide\n",
      "Everolimus\n",
      "Teniposide\n",
      "Cabazitaxel\n",
      "Crizotinib\n",
      "Romidepsin\n",
      "Axitinib\n",
      "Thiotepa\n",
      "Ruxolitinib\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efeed958f40> Floxuridine\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Vismodegib\n",
      "Megestrol acetate\n",
      "Methoxsalen\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efee6e24360> Megestrol acetate\n",
      "========================================================================\n",
      "Thalidomide\n",
      "Carmustine\n",
      "Floxuridine\n",
      "Methoxsalen\n",
      "Dacarbazine\n",
      "Ruxolitinib\n",
      "Lenalidomide\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitotane\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efee0afe270> Valrubicin\n",
      "========================================================================\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efed47b73b0> Teniposide\n",
      "========================================================================\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Crizotinib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Bortezomib\n",
      "Mitoxantrone\n",
      "Thiotepa\n",
      "Ruxolitinib\n",
      "Vandetanib\n",
      "Everolimus\n",
      "Gefitinib\n",
      "Axitinib\n",
      "Cabazitaxel\n",
      "Romidepsin\n",
      "Vismodegib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efecdb07680> Lenalidomide\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Methoxsalen\n",
      "Megestrol acetate\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efec4ac3d60> Oxaliplatin\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Vandetanib\n",
      "Romidepsin\n",
      "Gefitinib\n",
      "Vismodegib\n",
      "Crizotinib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efec05e79a0> Methoxsalen\n",
      "========================================================================\n",
      "Floxuridine\n",
      "Megestrol acetate\n",
      "Lenalidomide\n",
      "Arsenic trioxide\n",
      "Ruxolitinib\n",
      "Bortezomib\n",
      "Carmustine\n",
      "Dacarbazine\n",
      "Axitinib\n",
      "Ifosfamide\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efeaea61c70> Mitotane\n",
      "========================================================================\n",
      "Everolimus\n",
      "Exemestane\n",
      "Gefitinib\n",
      "Ifosfamide\n",
      "Megestrol acetate\n",
      "Thiotepa\n",
      "Vandetanib\n",
      "Teniposide\n",
      "Axitinib\n",
      "Crizotinib\n",
      "Ruxolitinib\n",
      "Romidepsin\n",
      "Cabazitaxel\n",
      "Bortezomib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe957eef40> Uracil mustard\n",
      "========================================================================\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe8a9e8770> Dacarbazine\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Megestrol acetate\n",
      "Methoxsalen\n",
      "Axitinib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe70af4a40> Fulvestrant\n",
      "========================================================================\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe6caf29a0> Dactinomycin\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Everolimus\n",
      "Gefitinib\n",
      "Vismodegib\n",
      "Vandetanib\n",
      "Crizotinib\n",
      "Axitinib\n",
      "Romidepsin\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe695e29f0> Exemestane\n",
      "========================================================================\n",
      "Mitotane\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe653edef0> Hydroxyurea\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Gefitinib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe5ef2c270> Thalidomide\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Megestrol acetate\n",
      "Amifostine\n",
      "Romidepsin\n",
      "Axitinib\n",
      "Crizotinib\n",
      "Gefitinib\n",
      "Vismodegib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe5eb66b80> Melphalan\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Everolimus\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Carmustine\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe4b4e27c0> Amifostine\n",
      "========================================================================\n",
      "Thalidomide\n",
      "Arsenic trioxide\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe477e6450> Arsenic trioxide\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Lomustine\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Everolimus\n",
      "Crizotinib\n",
      "Amifostine\n",
      "Vandetanib\n",
      "Romidepsin\n",
      "Methoxsalen\n",
      "Megestrol acetate\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe456ec090> Ifosfamide\n",
      "========================================================================\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Mitotane\n",
      "Crizotinib\n",
      "Megestrol acetate\n",
      "Bortezomib\n",
      "Teniposide\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Romidepsin\n",
      "Everolimus\n",
      "Axitinib\n",
      "Vandetanib\n",
      "Mitoxantrone\n",
      "Gefitinib\n",
      "Vismodegib\n",
      "Methoxsalen\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe41768ef0> Mitoxantrone\n",
      "========================================================================\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Gefitinib\n",
      "Vismodegib\n",
      "Bortezomib\n",
      "Teniposide\n",
      "Ifosfamide\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Vandetanib\n",
      "Everolimus\n",
      "Axitinib\n",
      "Crizotinib\n",
      "Romidepsin\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe41306e00> Lomustine\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Teniposide\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Everolimus\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efe1ed8f680> Everolimus\n",
      "========================================================================\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Bortezomib\n",
      "Thiotepa\n",
      "Ruxolitinib\n",
      "Dactinomycin\n",
      "Cabazitaxel\n",
      "Crizotinib\n",
      "Vandetanib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Teniposide\n",
      "Gefitinib\n",
      "Mitoxantrone\n",
      "Axitinib\n",
      "Romidepsin\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efdf40ca180> Thiotepa\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Cabazitaxel\n",
      "Ruxolitinib\n",
      "Everolimus\n",
      "Crizotinib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Teniposide\n",
      "Mitoxantrone\n",
      "Gefitinib\n",
      "Romidepsin\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efde46c8680> Vandetanib\n",
      "========================================================================\n",
      "Everolimus\n",
      "Crizotinib\n",
      "Oxaliplatin\n",
      "Arsenic trioxide\n",
      "Cladribine\n",
      "Bortezomib\n",
      "Romidepsin\n",
      "Dactinomycin\n",
      "Cabazitaxel\n",
      "Axitinib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Gefitinib\n",
      "Teniposide\n",
      "Mitoxantrone\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efddbecb0e0> Romidepsin\n",
      "========================================================================\n",
      "Crizotinib\n",
      "Oxaliplatin\n",
      "Bortezomib\n",
      "Arsenic trioxide\n",
      "Vandetanib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Gefitinib\n",
      "Mitoxantrone\n",
      "Thalidomide\n",
      "Cabazitaxel\n",
      "Teniposide\n",
      "Axitinib\n",
      "Thiotepa\n",
      "Dactinomycin\n",
      "Everolimus\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efdd0ac94a0> Axitinib\n",
      "========================================================================\n",
      "Crizotinib\n",
      "Vandetanib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Gefitinib\n",
      "Teniposide\n",
      "Mitoxantrone\n",
      "Thalidomide\n",
      "Cabazitaxel\n",
      "Romidepsin\n",
      "Vismodegib\n",
      "Bortezomib\n",
      "Carmustine\n",
      "Methoxsalen\n",
      "Dacarbazine\n",
      "Everolimus\n",
      "Dactinomycin\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efdc850cdb0> Cabazitaxel\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Thiotepa\n",
      "Ruxolitinib\n",
      "Everolimus\n",
      "Crizotinib\n",
      "Vandetanib\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Mitoxantrone\n",
      "Gefitinib\n",
      "Teniposide\n",
      "Axitinib\n",
      "Romidepsin\n",
      "Vismodegib\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efdaf66fe00> Vismodegib\n",
      "========================================================================\n",
      "Floxuridine\n",
      "Cladribine\n",
      "Oxaliplatin\n",
      "Gefitinib\n",
      "Dactinomycin\n",
      "Mitoxantrone\n",
      "Ifosfamide\n",
      "Cabazitaxel\n",
      "Axitinib\n",
      "Teniposide\n",
      "Bortezomib\n",
      "Thalidomide\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efdae078720> Crizotinib\n",
      "========================================================================\n",
      "Everolimus\n",
      "Ruxolitinib\n",
      "Vandetanib\n",
      "Romidepsin\n",
      "Bortezomib\n",
      "Ifosfamide\n",
      "Cabazitaxel\n",
      "Teniposide\n",
      "Axitinib\n",
      "Thiotepa\n",
      "Arsenic trioxide\n",
      "Dactinomycin\n",
      "Mitotane\n",
      "Gefitinib\n",
      "Mitoxantrone\n",
      "Thalidomide\n",
      "Oxaliplatin\n",
      "<Element '{http://www.drugbank.ca}drug' at 0x7efdad298c70> Ruxolitinib\n",
      "========================================================================\n",
      "Bortezomib\n",
      "Cladribine\n",
      "Carmustine\n",
      "Chlorambucil\n",
      "Floxuridine\n",
      "Lenalidomide\n",
      "Oxaliplatin\n",
      "Dacarbazine\n",
      "Dactinomycin\n",
      "Hydroxyurea\n",
      "Thalidomide\n",
      "Melphalan\n",
      "Arsenic trioxide\n",
      "Lomustine\n",
      "Thiotepa\n",
      "Cabazitaxel\n",
      "Everolimus\n",
      "Crizotinib\n",
      "Megestrol acetate\n",
      "Methoxsalen\n",
      "Mitotane\n",
      "Ifosfamide\n",
      "Teniposide\n",
      "Mitoxantrone\n",
      "Gefitinib\n"
     ]
    }
   ],
   "source": [
    "pairList=[]\n",
    "for x in root.findall('{http://www.drugbank.ca}drug'):\n",
    "    name =x.find('{http://www.drugbank.ca}name').text\n",
    "    if name in druglist:\n",
    "        print(x,name)\n",
    "        print(\"========================================================================\")\n",
    "        for elem in x.iter(tag='{http://www.drugbank.ca}drug-interaction'):\n",
    "            #for child in elem:\n",
    "            if elem.find(\"{http://www.drugbank.ca}name\").text in druglist:\n",
    "                print(elem.find(\"{http://www.drugbank.ca}name\").text)\n",
    "                pairList.append(set((name,elem.find(\"{http://www.drugbank.ca}name\").text)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "322\n"
     ]
    }
   ],
   "source": [
    "# del repeated interactions\n",
    "temp = []\n",
    "for item in pairList:\n",
    "    if not item in temp:\n",
    "        temp.append(item)\n",
    "print(len(temp))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "fw = open('drugbank_interactions_50FDA','wb')\n",
    "pickle.dump(temp,fw)\n",
    "fw.close()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ml",
   "language": "python",
   "name": "ml"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
